Small cleanup in gtk_window_draw
authorMatthias Clasen <mclasen@redhat.com>
Mon, 18 Mar 2013 12:36:04 +0000 (08:36 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 18 Mar 2013 12:50:22 +0000 (08:50 -0400)
Get the allocation once, at the beginning.

gtk/gtkwindow.c

index d1455014f9eef722a8077b634b3ab12b07e4ddef..edcbb53638445dc87ac50457c2b4360e35c4dd51 100644 (file)
@@ -8850,6 +8850,8 @@ gtk_window_draw (GtkWidget *widget,
 
   context = gtk_widget_get_style_context (widget);
 
+  gtk_widget_get_allocation (widget, &allocation);
+
   if (priv->title_box != NULL)
     get_decoration_borders (widget, &title_border, &inner_border, &outer_border);
   else
@@ -8859,7 +8861,6 @@ gtk_window_draw (GtkWidget *widget,
       gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
     {
       gtk_style_context_save (context);
-
       gtk_style_context_add_class (context, GTK_STYLE_CLASS_BACKGROUND);
 
       if (priv->client_decorated &&
@@ -8867,7 +8868,6 @@ gtk_window_draw (GtkWidget *widget,
           !priv->fullscreen &&
           !(gdk_window_get_state (gtk_widget_get_window (widget)) & GDK_WINDOW_STATE_MAXIMIZED))
         {
-          gtk_widget_get_allocation (widget, &allocation);
           gtk_style_context_add_class (context, "window-border");
           gtk_render_background (context, cr,
                                  inner_border.left + outer_border.left,
@@ -8890,7 +8890,6 @@ gtk_window_draw (GtkWidget *widget,
         }
       else
         {
-          gtk_widget_get_allocation (widget, &allocation);
           gtk_render_background (context, cr,
                                  0, 0, allocation.width, allocation.height);
         }